]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Fix a stuck grab related to bubble notifications
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 22 May 2013 17:20:20 +0000 (13:20 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 24 May 2013 17:29:07 +0000 (13:29 -0400)
If the user middle clicks on a summary item in the tray, we'll
try to grab null instead of an actor, which is wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=700854

js/ui/messageTray.js

index 68f4e5c5fdea6d03678f7fff336647bac003a03c..b17053b1e4ae93301edda4dad8cab2fbe9281c6d 100644 (file)
@@ -2633,28 +2633,35 @@ const MessageTray = new Lang.Class({
     },
 
     _showSummaryBoxPointer: function() {
-        this._summaryBoxPointerItem = this._clickedSummaryItem;
-        this._summaryBoxPointerContentUpdatedId = this._summaryBoxPointerItem.connect('content-updated',
-                                                                                      Lang.bind(this, this._onSummaryBoxPointerContentUpdated));
-        this._sourceDoneDisplayingId = this._summaryBoxPointerItem.source.connect('done-displaying-content',
-                                                                                  Lang.bind(this, this._onSourceDoneDisplayingContent));
-
-        let hasRightClickMenu = this._summaryBoxPointerItem.rightClickMenu != null;
-        if (this._clickedSummaryItemMouseButton == 1 || !hasRightClickMenu) {
+        let child;
+        let summaryItem = this._clickedSummaryItem;
+        if (this._clickedSummaryItemMouseButton == 1) {
             // Acknowledge all our notifications
-            this._summaryBoxPointerItem.source.notifications.forEach(function(n) { n.acknowledged = true; });
+            summaryItem.source.notifications.forEach(function(n) { n.acknowledged = true; });
 
-            this._summaryBoxPointer.bin.child = this._summaryBoxPointerItem.notificationStackWidget;
+            child = summaryItem.notificationStackWidget;
 
-            let closeButton = this._summaryBoxPointerItem.closeButton;
+            let closeButton = summaryItem.closeButton;
             closeButton.show();
             this._summaryBoxPointerCloseClickedId = closeButton.connect('clicked', Lang.bind(this, this._hideSummaryBoxPointer));
-            this._summaryBoxPointerItem.prepareNotificationStackForShowing();
+            summaryItem.prepareNotificationStackForShowing();
         } else if (this._clickedSummaryItemMouseButton == 3) {
-            this._summaryBoxPointer.bin.child = this._clickedSummaryItem.rightClickMenu;
+            child = summaryItem.rightClickMenu;
             this._summaryBoxPointerCloseClickedId = 0;
         }
 
+        // If the user clicked the middle mouse button, or the item
+        // doesn't have a right-click menu, do nothing.
+        if (!child)
+            return;
+
+        this._summaryBoxPointerItem = summaryItem;
+        this._summaryBoxPointerContentUpdatedId = this._summaryBoxPointerItem.connect('content-updated',
+                                                                                      Lang.bind(this, this._onSummaryBoxPointerContentUpdated));
+        this._sourceDoneDisplayingId = this._summaryBoxPointerItem.source.connect('done-displaying-content',
+                                                                                  Lang.bind(this, this._onSourceDoneDisplayingContent));
+
+        this._summaryBoxPointer.bin.child = child;
         this._grabHelper.grab({ actor: this._summaryBoxPointer.bin.child,
                                 modal: true,
                                 onUngrab: Lang.bind(this, this._onSummaryBoxPointerUngrabbed) });